package com.example.demo.service;

import com.example.demo.dao.ArticleMapper;
import com.example.demo.model.ArticleInfo;
import com.example.demo.model.Userinfo;
import com.example.demo.model.vo.UserinfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: 杰
 * Date: 2023 -08 -12
 * Time: 17:53
 */
@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public List<ArticleInfo> getListByUid(int uid) {
        return articleMapper.getListByUid(uid);
    }

    public int del(Integer aid, int uid) {
        return articleMapper.del(aid,uid);
    }

    public int add(ArticleInfo articleInfo) {
        return articleMapper.add(articleInfo);
    }

    public ArticleInfo getArticleByUidAndId(Integer aid, int uid) {
        return articleMapper.getArticleByUidAndId(aid,uid);
    }

    public int UpdateByAidAndUid(ArticleInfo articleInfo) {
        return articleMapper.UpdateByUidAndId(articleInfo);
    }

    public ArticleInfo getDetail(int aid) {
        return articleMapper.getDetailById(aid);
    }

    public int getArtCountByUid(int uid) {
        return articleMapper.getArtCountByUid(uid);
    }

    public int incrementRCount(int aid) {
        return articleMapper.incrementRCount(aid);
    }

    public List<ArticleInfo> getListByPage(int psize, int offset) {
        return articleMapper.getListByPage(psize,offset);
    }

    public int getCount() {
        return articleMapper.getCount();
    }
}
